package com.qf.ithub.user.service;

import com.qf.ithub.user.entity.User;
import com.qf.ithub.user.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    /**
     *  根据id 查询 user
     */
    public User findUserById(Integer id){
        return userMapper.selectByPrimaryKey(id);
    }

    /**
     *  添加user
     */
    @Transactional
    public void addUser(User user){
        userMapper.insertSelective(user);
    }
}
